
import 'dart:typed_data';

import 'rebellion_udp_platform_interface.dart';

class RebellionUdp {
  Future<String?> getPlatformVersion() {
    return RebellionUdpPlatform.instance.getPlatformVersion();
  }

  Future<void> init(String multicastAddress, int port) async {
    await RebellionUdpPlatform.instance.init(multicastAddress, port);
  }

  void send(Uint8List data) {
    RebellionUdpPlatform.instance.send(data);
  }

  void sendToTarget(String ip, Uint8List data) {
    RebellionUdpPlatform.instance.sendToTarget(ip, data);
  }

  void listen(Function(Uint8List) read, Function() write, Function() closed) {
    RebellionUdpPlatform.instance.listen(read: read, write: write, closed: closed);
  }

  void close() {
    RebellionUdpPlatform.instance.close();
  }

  Future<bool?> isOpen() {
    return RebellionUdpPlatform.instance.isOpen();
  }
}
